<template>
<div class="api">
  <div class="swiper-container huadong">
      <div class="swiper-wrapper">
        <div class="swiper-slide"><img src="../../assets/img/xa.png"></div>
        <div class="swiper-slide"><img src="../../assets/img/xc.png"></div>
      </div>
      <div class="swiper-pagination"></div>
  </div>
  <!--内容-->
  <div class="xlist" >
    <div class="xshowList" v-for="(n,index) in goods" @click="changePage(index)">
      <!--头部-->
      <div class="xshowt">
        <span class="xtx"><img :src="n.img1"></span>
        <div class="xmy">
          <h4>{{n.txt1}}</h4>
          <span>{{n.time}}</span>
        </div>
      </div>
      <!--图片-->
      <div class="xshowc">
        <div class="xshowcl">
          <img :src="n.img2">
        </div>
        <div class="xshowcr">
          <div class="xrt">
            <img :src="n.img3">
          </div>
          <div class="xrb">
            <div class="xpaizi">
              <p>{{n.txt2}}</p>
              <p>{{n.txt3}}</p>
            </div>
            <p class="xprice">￥{{n.price}}</p>
          </div>
        </div>
      </div>
      <!--地下-->
      <div class="xshowb">
        <p class="xwor">{{n.txt4}}</p>
      </div>
    </div>

  </div>
</div>

</template>
<script >
    export default {
      props:["idx","goods"],
      methods:{
        changePage:function (idx){
            this.$router.push("/details?id="+idx);
        }
      },
      mounted:()=>{
        console.log("挂在好了");
        var mySwiper = new Swiper ('.huadong',{
          loop: true,
          autoplay:1000,
          pagination : '.swiper-pagination'
        })
      }
    }
</script>

<style lang="scss">
  .api{
    width: 100%;
    flex: 1;
    overflow-x: auto;
    overflow: hidden;
  }
  .huadong img{
    width: 100%;
    height: 2.35rem;
  }
  .xshowList{
    width: 100%;
    background: white;
    border-bottom: 1px solid #dddddd;
  }
  .xshowt{
    background: white;
    display: flex;
    margin-top: 0.1rem;
    padding: 0.2rem 0;
  }
  .xshowt .xtx{
    display: inline-block;
    width: 0.4rem;
    height:0.4rem;
    margin: 0 0.2rem;
  }
  .xtx img{
    width: 100%;
    height:100%;
    vertical-align: middle;
  }
  .xmy{
    font-size: 16px;

  }
  .xmy h4{
    font-size: 16px;
    color: #151515;
  }
  .xmy span{
    color: #6e6e6e;
    font-weight: 600;
  }
  .xshowc{
    display: flex;
    position: relative;
    overflow: hidden;
  }
  .xshowcl{
    height: 3rem;
    width: 60%;
  }
  .xshowcl img{
    width: 2rem;
    height: 3.1rem;
  }
  .xshowcr{
    width: 40%;
  }
  .xrt{
    width: 1.2rem;
    height: 1.8rem;
    margin-bottom: 0.2rem;
  }
  .xrt img{
    width: 100%;
    height: 100%;
  }
  .xsijian{
    position: absolute;
    top: 0.5rem;
    left:2.8rem;
    display: flex;
    width:100%;
    height: 1.37rem;
  }
  .xsijian .xfour{
    background:rgba(0,0,0,0);
  }
  .xsijian .xfour p{
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: 0.6rem;
    height: 0.6rem;
    border: 2px solid white;
    font-size: 16px;
    color: white;
    margin:0 auto;
    span{
      text-align: center;
    }
  }
  .xsijian li{
    width: 0.97rem;
    height: 1.37rem;
    background: white;
    margin-right: 0.22rem;
  }
  .xsijian li p{
    font-size: 16px;
    text-align: center;
    width: 97%;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
  }
  .xsijian li p:last-child{
    font-size: 12px;
    color: #dddddd;
  }
  .xsijian p span:first-child{
    font-size: 22px;
  }
  .xsijian li img{
    width: 0.74rem;
    height: 0.74rem;
    margin: 0.1rem auto;
    margin-right: 0.13rem;
  }
  .xsijian li p{
    font-size: 16px;
  }
  .hide{
    display: flex;
    display: none;
  }
  .xwor{
    font-size: 14px;
  }
  .xrb{
    line-height: 0.3rem;
    font-size: 16px;
    color: #191919;
    font-weight: 600;
  }
  .xpaizi{
    border-bottom: 1px solid #1B1B1B;
    width: 1.3rem;
    p{
      text-align: center;
    }
  }
  .xrb .xprice{
    color: #a82034;
    text-align: center;
  }
  .xshowb{
    font-size: 18px;
    color: #585858;
    margin: 0.17rem 0.1rem;
  }

</style>
